package org.codeart.driver.controller;

import org.codeart.common.response.OrderDriverResponse;
import org.codeart.common.util.R;
import org.codeart.driver.service.DriverUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    private DriverUserService driverUserService;

    /**
     * 根据车辆id查询订单需要的司机信息
     * @param carId 车辆id
     */
    @GetMapping("/available-driver/{carId}")
    public R<OrderDriverResponse> getAvailableDriver(@PathVariable("carId") Long carId) {
        return driverUserService.getAvailableDriver(carId);
    }
}
